// 环境相关接口
import request from '../service/service';

/**
 * 获取摄像头列表
 */
export function getCameraDeviceList(data) {
  return request({
    protocol: '/bus/camera/local/findPage',
    options: data,
    method: 'get',
  });
}

/**
 * 根据deviceSerial获取播放地址
 */
export function getAddressByDeviceSerial(data) {
  return request({
    protocol: '/bus/camera/getAddressByDeviceSerial',
    options: data,
    method: 'post',
    hasQuery: true,
  });
}

/**
 * 获取未来几天天气
 */
export function getDaysWeather(data) {
  return request({
    protocol: 'bus/weather/getDaysWeather',
    options: data,
    method: 'get'
  });
}

/**
 * 根据项目id获取天气code
 */
export function getWeatherCode(data) {
  return request({
    protocol: 'bus/weather/getWeatherCode',
    options: data,
    method: 'get'
  });
}

/**
 * 根据日期获取环境相关数据
 */
export function getEnvirDataList(data) {
  return request({
    protocol: '/bus/envir/getEnvirDataList',
    options: data,
    method: 'post',
    hasQuery: true
  });
}

/**
 * 根据日期获取环境最新数据
 */
export function getEnvirDataListNew(data) {
  return request({
    protocol: '/bus/envir/getEnvirDataListNew',
    options: data,
    method: 'post',
    hasQuery: true
  });
}

/**
 * 根据日期获取环境相关数据（查询最近条数(默认500)）
 */
export function getLatelyEnvirDataList(data) {
  return request({
    protocol: '/bus/envir/getLatelyEnvirDataList',
    options: data,
    method: 'post',
    hasQuery: true
  });
}

/**
 * 保存环境相关的推送数据
 */
export function savePushEnvirData(data) {
  return request({
    protocol: '/bus/envir/savePushEnvirData',
    options: data,
    method: 'post',
    hasQuery: true
  });
}

/**
 * 新增阈值
 */
export function addEnvirThreshold(data) {
  return request({
    protocol: 'bus/envir/threshold/create',
    options: data,
    method: 'post',
  });
}

/**
 * 删除阈值
 */
export function delEnvirThreshold(data) {
  return request({
    protocol: 'bus/envir/threshold/deleteByIds',
    options: data,
    method: 'delete',
  });
}

/**
 * 获取阈值列表
 */
export function getEnvirThreshold(data) {
  return request({
    protocol: 'bus/envir/threshold/findPage',
    options: data,
    method: 'get',
  });
}

/**
 * 修改阈值
 */
export function updateEnvirThreshold(data) {
  return request({
    protocol: 'bus/envir/threshold/update',
    options: data,
    method: 'post',
  });
}

/**
 * 获取环境预警信息
 */
export function getEnvirAlarmList(data) {
  return request({
    protocol: 'bus/envir/alarm/findPage',
    options: data,
    method: 'get',
  });
}

/**
 * 获取摄像头配置信息
 */
export function getCameraConfigList(data) {
  return request({
    protocol: 'bus/camera/config/findPage',
    options: data,
    method: 'get',
  });
}

/**
 * 新增摄像头配置信息
 */
export function addCameraConfig(data) {
  return request({
    protocol: 'bus/camera/config/create',
    options: data,
    method: 'post',
  });
}

/**
 * 修改摄像头配置信息
 */
export function updateCameraConfig(data) {
  return request({
    protocol: 'bus/camera/config/create',
    options: data,
    method: 'post',
  });
}

/**
 * 删除本地摄像头
 */
export function delLocalCamera(data) {
  return request({
    protocol: 'bus/camera/local/deleteByIds',
    options: data,
    method: 'delete',
  });
}

/**
 * 获取当前账号下所有摄像头
 */
export function getCameraListAll(data) {
  return request({
    protocol: 'bus/camera/getCameraList',
    options: data,
    method: 'post',
    hasQuery: true
  });
}

/**
 * 新增当前项目摄像头
 */
export function addLocalCamera(data) {
  return request({
    protocol: 'bus/camera/local/create',
    options: data,
    method: 'post',
  });
}

/**
 * 修改当前项目摄像头
 */
export function updateLocalCamera(data) {
  return request({
    protocol: 'bus/camera/local/update',
    options: data,
    method: 'post',
  });
}

/**
 * 删除环境预警记录
 */
export function delEnvirAlarm(data) {
  return request({
    protocol: 'bus/envir/alarm/deleteByIds',
    options: data,
    method: 'DELETE',
  });
}

/**
 * 获取历史天气
 */
export function getEnvirHistory(data) {
  return request({
    protocol: 'bus/envir/history/findPage',
    options: data,
    method: 'get',
  });
}
